import gulp from 'gulp';
import fs from 'fs';
import path from 'path';


const list = [
	'delivery-time',
	'trade-analysis',
	'realtime-data-survey',
	'realtime-data-list',
	'realtime-data-list-detail',
	'realtime-data-pay',
	'realtime-data-compare',
	'flow-analysis',
	'sell-analysis',
	'data-analysis',
	'analysis-indication'
];


const less = () => `@import "./_report-mixins.less";
@import "./_report-variables.less";
`;

const tpl = m => `<!DOCTYPE html>
<html>
<head>
	<% include ../common/meta.tpl %>
	<link rel="stylesheet" type="text/css" href="<%=ctx%>/assets/css/common/vendor.css">
	<link rel="stylesheet" type="text/css" href="<%=ctx%>/assets/css/report/${m}.css">
</head>
<body>
<div class="fm-container">

</div>
`;


gulp.task('test', (next) => {
	for (const m of list) {
		fs.appendFile(path.join(__dirname, 'less', `${m}.less`), less(m), err => (err && console.log(err)));
		fs.appendFile(path.join(__dirname, 'tpl', `${m}.tpl`), tpl(m), err => (err && console.log(err)));
	}
	next();
});
